﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WaterFather : MonoBehaviour
{
    private void Awake()
    {
        colliderInfos = new List<CollisionArgs>();
    }
    private void Update()
    {
    }
    /// <summary>
    /// 粒子数
    /// </summary>
    [Header("总水珠数")]
    public int particleCount;
    [Header("根物体")]
    public GameObject root;
    //接口
    /*  public void Create(int id)
      {
          if (GetMetaData(id) == null)
          {
              var obj = GameObject.Instantiate(root, this.transform);
              obj.GetComponent<MetaballParticle>().baseInfo.idEntity = id;
              obj.GetComponent<MetaballParticle>().baseInfo.elementState = ElementState.water;
              metaBallDIC.Add(id, obj.GetComponent<MetaballParticle>());
          }
          else
          {
              Debug.LogError(id + "：物体已存在,创建失败");
          }
      }*/
    /*   private void Create(MetaballParticle data)
       {
           var obj = GameObject.Instantiate(root, this.transform);
           var meta = obj.GetComponent<MetaballParticle>();
           meta.baseInfo.idEntity = data.baseInfo.idEntity;
           meta.extraInfo = data.extraInfo;
           meta.baseInfo.blood = data.baseInfo.blood;
           meta.baseInfo.elementState = data.baseInfo.elementState;
           metaBallDIC.Add(meta.baseInfo.idEntity, meta);
       }*/
    //   private List<MetaballParticle> outDatas = new List<MetaballParticle>();
    /* public List<MetaballParticle> SummaryData()
     {
         if (outDatas.Count > 0)
         {
             outDatas.Clear();
         }
         foreach(var x in metaBallDIC)
         {
             outDatas.Add(x.Value);
         }
         return outDatas;
     }*/
    /*  public void SetAllData(List<MetaballParticle> datas)
      {
          if (metaBallDIC.Count != 0)
          {
              metaBallDIC.Clear();
          }
          foreach(var x in datas)
          {
              Create(x);
          }

      }*/
    public List<CollisionArgs> colliderInfos = new List<CollisionArgs>();
    /*   public List<WaterColliderInfo> GetColliderInfo()
       {
           temColliderInfos= new List<WaterColliderInfo>();
           foreach (var x in colliderInfos)
           {
               temColliderInfos.Add(x);
           }
           colliderInfos.Clear();
           return temColliderInfos;
       }*/
    /*  public Tuple<int,string> GetColliderInfo(Collider2D collider)
      {
         var t= collider.gameObject.GetComponent<MetaballParticle>();
         return  t.GetSystem(collider);
      }
      OverlapInfo overlapInfo=new OverlapInfo();*/
    /*  private void SetOverlapInfo(Collider2D[] colliders)
      {
          if (overlapInfo.lapInfo.Count > 0)
          {
              overlapInfo.lapInfo.Clear();
          }
          foreach (var x in colliders)
          {
              var t = x.gameObject.GetComponent<MetaballParticle>();
              overlapInfo.lapInfo.Add(new Tuple<int, float>(t.baseInfo.idEntity, 1));
          }
      }*/
    /* public OverlapInfo GetOverlapInfo(Area area)
      {
          if(area as Box != null)
          {
             var colliders= Physics2D.OverlapAreaAll((area as Box).point1, (area as Box).point2);
              SetOverlapInfo(colliders);
          }
          else if(area as Circle != null){
              var colliders = Physics2D.OverlapCircleAll((area as Circle).point, (area as Circle).radius);
              SetOverlapInfo(colliders);
          }
          return overlapInfo;


      }*/


    /*   FixedInfo fixedInfo = new FixedInfo();
       public FixedInfo GetFixedInfo(ElementState ele)
       {
           switch (ele)
           {
               case ElementState.water:
                   fixedInfo.InitBlood = 100;
                   fixedInfo.Defence = 100;
                   fixedInfo.MagicDefence = 100;
                   fixedInfo.Sharpness = 1;
                   fixedInfo.Mass = 1;
                   break;
           }
           return fixedInfo;
       }
   }*/
}



    /*public interface IFluid
    {
        BaseInfo GetInfo(int id);
        void SetInfo(int id, BaseInfo info);
        ExtraInfo GetExtraInfo(int id);
        void SetExtraInfo(int id, ExtraInfo info);
        int Create();
        void Create(int Identity);
        void Delete(int id);
        List<MetaballParticle> SummaryData();
        void SetAllData(List<MetaballParticle> datas);
        List<WaterColliderInfo> GetColliderInfo();
        Tuple<int, string> GetColliderInfo(Collider2D collider);
        OverlapInfo GetOverlapInfo(Area area);
    }
    */

    public struct ExtraInfo
    {
        public Vector2 position;
    }
    /*public enum ElementState
        {
            /// <summary>
            /// 金属
            /// </summary>
            metal,
            /// <summary>
            /// 玻璃
            /// </summary>
            glass,
            /// <summary>
            /// 木头
            /// </summary>
            wood,
            /// <summary>
            /// 毒
            /// </summary>
            poison,
            /// <summary>
            /// 岩浆
            /// </summary>
            magma,
            /// <summary>
            /// 土
            /// </summary>
            soil,
            /// <summary>
            /// 燃料
            /// </summary>
            fuel,
            /// <summary>
            /// 泥潭
            /// </summary>
            mudrush,
            /// <summary>
            /// 冰
            /// </summary>
            ice,
            /// <summary>
            /// 水
            /// </summary>
            water,
            /// <summary>
            /// 风
            /// </summary>
            wind,
            /// <summary>
            /// 火
            /// </summary>
            fire,
            /// <summary>
            /// 电
            /// </summary>
            flash,
            /// <summary>
            /// 蒸汽
            /// </summary>
            steam,
        }*/
